﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace WebshopPizzaRio
{
    public partial class Site : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Zoek.Attributes.Add("onblur", "WaterMark(this, event);");
            Zoek.Attributes.Add("onfocus", "WaterMark(this, event);");  

            SessionGuid();
            
            ShoppingCart cart = (ShoppingCart)Session["shoppingcart"];

            ListView1.DataSource = cart.getShoppingCart;
            ListView1.DataBind();
            Label1.Text = "Totaal bedrag: € " + cart.getTotaalBedrag();

        }

        protected void SessionGuid()
        {
            try
            {
                MembershipUser MB = Membership.GetUser();
                Guid userid = (Guid)MB.ProviderUserKey;
                Session["SessionUserId"] = userid;
            }
            catch (NullReferenceException)
            {

            }
        }

        protected void Button1(object sender, FormViewPageEventArgs e)
        {

        }

        protected void ZoekBtn_Click(object sender, EventArgs e)
        {
            Response.Redirect("Pizza-bestellen.aspx?Zoek=" + Zoek.Text);
        }
    }
}